gh-114914: Avoid keeping dead StreamWriter alive#115661
Merged
gvanrossum merged 2 commits intopython:mainfrom Feb 28, 2024
Merged
gh-114914: Avoid keeping dead StreamWriter alive#115661gvanrossum merged 2 commits intopython:mainfrom
gvanrossum merged 2 commits intopython:mainfrom
Conversation
In some cases we might cause a StreamWriter to stay alive even when the application has dropped all references to it. This prevents us from doing automatical cleanup, and complaining that the StreamWriter wasn't properly closed. Fortunately, the extra reference was never actually used for anything so we can just drop it.
gvanrossum
reviewed
Feb 19, 2024
| addr = srv.sockets[0].getsockname() | ||
| with socket.create_connection(addr): | ||
| # Give the loop some time to notice the connection | ||
| await asyncio.sleep(0.1) |
Member
There was a problem hiding this comment.
Like in the other PR, I believe that one or two sleep(0) should deterministically reach the state you're waiting for?
Contributor
Author
There was a problem hiding this comment.
Three, actually.
But I'm cautious about this change. Right now, it seems to require three. But someone might change something so that tomorrow this requires four. At which point this test will start reporting "ok" even if everything is broken. :/
Contributor
Author
There was a problem hiding this comment.
I think adding a future to wait on could give something more reliable in this specific case.
gvanrossum
approved these changes
Feb 28, 2024
Member
gvanrossum
left a comment
There was a problem hiding this comment.
Looks great. Will merge. Thanks for finding and fixing this!
gvanrossum
pushed a commit
to gvanrossum/cpython
that referenced
this pull request
Feb 28, 2024
In some cases we might cause a StreamWriter to stay alive even when the application has dropped all references to it. This prevents us from doing automatical cleanup, and complaining that the StreamWriter wasn't properly closed. Fortunately, the extra reference was never actually used for anything so we can just drop it.
Member
|
Please, see #116112 |
woodruffw
pushed a commit
to woodruffw-forks/cpython
that referenced
this pull request
Mar 4, 2024
In some cases we might cause a StreamWriter to stay alive even when the application has dropped all references to it. This prevents us from doing automatical cleanup, and complaining that the StreamWriter wasn't properly closed. Fortunately, the extra reference was never actually used for anything so we can just drop it.
adorilson
pushed a commit
to adorilson/cpython
that referenced
this pull request
Mar 25, 2024
In some cases we might cause a StreamWriter to stay alive even when the application has dropped all references to it. This prevents us from doing automatical cleanup, and complaining that the StreamWriter wasn't properly closed. Fortunately, the extra reference was never actually used for anything so we can just drop it.
diegorusso
pushed a commit
to diegorusso/cpython
that referenced
this pull request
Apr 17, 2024
In some cases we might cause a StreamWriter to stay alive even when the application has dropped all references to it. This prevents us from doing automatical cleanup, and complaining that the StreamWriter wasn't properly closed. Fortunately, the extra reference was never actually used for anything so we can just drop it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In some cases we might cause a StreamWriter to stay alive even when the application has dropped all references to it. This prevents us from doing automatical cleanup, and complaining that the StreamWriter wasn't properly closed.
Fortunately, the extra reference was never actually used for anything so we can just drop it.